import { Route, Routes, unstable_HistoryRouter as HistoryRouter } from "react-router-dom"
import { history } from "./utils/history"
// import Login from "./pages/Login"
import Login from '@/pages/Login'
import './App.css'
import GeekLayout from "./pages/Layout"
import { AuthComponent } from "./components/AuthRoute"
import Home from "./pages/Home"
import Article from "./pages/Article"
import Publish from "./pages/Publish"
function App () {
  return (
    // 路由配置
    <HistoryRouter history={history}>
      <div className="App">
        <Routes>
          {/* 创建路由path和组件的对应关系 */}
          {/* Layout需要鉴权处理 */}
          {/* 这里的Layout不能写死 要根据是否登录进行判断 */}
          <Route path="/" element={<AuthComponent><GeekLayout /></AuthComponent>}>
            <Route index element={<Home></Home>}></Route>
            <Route path="article" element={<Article></Article>}></Route>
            <Route path="publish" element={<Publish></Publish>}></Route>
          </Route>
          {/* 这个不需要 */}
          <Route path="/login" element={<Login />}></Route>
        </Routes>
      </div>
    </HistoryRouter>

  )
}

export default App
